//package com.demon.androidbasic.ui
//
//import android.content.Context
//import android.content.Intent
//import android.view.View
//import com.demon.androidbasic.R
//import com.demon.androidbasic.adapter.ImagePagerAdapter
//import com.demon.androidbasic.base.MyActivity
//import com.demon.androidbasic.databinding.ActivityImagePreviewBinding
//import com.demon.androidbasic.other.IntentKey
//import com.gyf.immersionbar.BarHide
//import com.gyf.immersionbar.ImmersionBar
//import cn.rockysports.weibu.rpc.dto.WBImage
//
//
///**
// * 预览图片
// */
//class ImagePreviewActivity : MyActivity<ActivityImagePreviewBinding>() {
//    private var dianZanSelect = false
//    private var likeSelect = false
//    override fun initBind() {
//        binding = ActivityImagePreviewBinding.inflate(inflater)
//    }
//
//    override fun initView() {
//        binding.pvImagePreviewIndicator.setViewPager(binding.vpImagePreviewPager)
//        setOnClickListener(binding.ivBack,binding.dianZanLayout,binding.likeLayout)
//    }
//
//    override fun initData() {
//        super.initData()
//        val images = getStringArray(IntentKey.IMAGE)
//        val index = getInt(IntentKey.INDEX)
//        //val wBImageList = getSerializable<WBImage>(IntentKey.WBImage)
//        if (images != null && images.isNotEmpty()) {
//            binding.vpImagePreviewPager.adapter = ImagePagerAdapter(this, images)
//            if (index != 0 && index <= images.size) {
//                binding.vpImagePreviewPager.currentItem = index
//            }
//        } else {
//            finish()
//        }
//    }
//
//    override fun onClick(v: View) {
//        when (v.id) {
//            R.id.iv_back -> {
//                finish()
//            }
//            R.id.dianZanLayout -> {
//                dianZanSelect = !dianZanSelect
//                binding.dianZanLayout.isSelected = dianZanSelect
//                binding.imageDianZan.isSelected = dianZanSelect
//            }
//            R.id.likeLayout -> {
//                likeSelect = !likeSelect
//                binding.likeLayout.isSelected = likeSelect
//                binding.imageLike.isSelected = likeSelect
//            }
//        }
//    }
//
//    override fun createStatusBarConfig(): ImmersionBar {
//        return super.createStatusBarConfig() // 隐藏状态栏和导航栏
//            .hideBar(BarHide.FLAG_HIDE_BAR)
//    }
//
//    override val isStatusBarDarkFont: Boolean
//        get() = false
//    override val isSwipeEnable: Boolean
//        get() = false
//
//    companion object {
//        fun start(context: Context, url: String?) {
//            url?.let { start(context, arrayOf(it)) }
//        }
//        @JvmStatic
//        fun start(context: Context, urls: MutableList<String?>, WBImageList: MutableList<WBImage?>, index: Int) {
//            start(context, urls.filterNotNull().toTypedArray(),WBImageList.filterNotNull().toTypedArray(), index)
//        }
//
//        fun start(context: Context, urls: Array<String>, WBImageList: Array<WBImage> = emptyArray(), index: Int = 0) {
//            val intent = Intent(context, ImagePreviewActivity::class.java)
//            intent.putExtra(IntentKey.IMAGE, urls)
//            intent.putExtra(IntentKey.ID, WBImageList)
//            intent.putExtra(IntentKey.INDEX, index)
//            context.startActivity(intent)
//        }
//
//    }
//}